<?php
/**
 * 天气数据
 * Created by PhpStorm.
 * User: liyy
 * Date: 2017/7/27 0027
 * Time: 下午 3:39
 */

namespace app\api\model;

use think\Db;
use think\Model;
class Weather extends Model{

    /**
     * @param $time  日期
     * @param $citycode 城市code
     */
    public function FindWeather($citycode,$time=''){
        if (empty($citycode)){
            return false;
        }
        if (empty($time)){
            $time = date('Y-m-d',time());
        }
        $data['datetime'] = $citycode;
        $data['citycode'] = $time;
        $return = Db::name('weather')->where($data)->find();
        return $return;
    }

    /**
     * @param $data 天气数据
     */
    public function UpdateWeather($data){
        $result = Db::name('weather')->insert($data);
        return $result;
    }

}